//
//  UIView+IBExtention.swift
//  weibo1
//
//  Created by 代亚洲 on 16/4/16.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit
//设置搜索中的边框
extension UIView {
//    、边框宽度
    @IBInspectable var borderWidth : CGFloat {
        
        get {
            return self.layer.borderWidth
        }
        
        set {
            self.layer.borderWidth = newValue
        }
        
    }
    
//    要赋值边框颜色 uicolor 要是 可选的
    @IBInspectable var  bordercolor : UIColor? {
        
        get {
            if let bc = self.layer.borderColor {
                return UIColor (CGColor: bc)
            }
            return nil
        }
        
        set {
            self.layer.borderColor = newValue?.CGColor
            
        }
        
    }
//    赋值边框圆角
    @IBInspectable var borderCornerRadiu :CGFloat {
        
        get {
            return self.layer.cornerRadius
        }
        
        set {
            
            self.layer.cornerRadius = newValue
//            当圆角的数值大于零时才裁剪
            self.layer.masksToBounds = (newValue > 0)
        }
    }
    
    
}
